/*
 * @Author: many
 * @Date: 2020-06-21 18:46:01
 * @LastEditors: di
 * @LastEditTime: 2020-06-22 14:27:34
 * @Description: file content
 */

import router from "./index";
import NProgress from "nprogress"; // progress bar
import "nprogress/nprogress.css"; // progress bar style
import getPageTitle from "@/utils/get-page-title";

NProgress.configure({ showSpinner: true }); // NProgress Configuration

router.beforeEach((to, from, next) => {
  // start progress bar
  NProgress.start();
  // set page title
  document.title = getPageTitle(to.meta);
  setTimeout(() => {
    next();
  }, 300);
});

router.afterEach(() => {
  // finish progress bar
  NProgress.done();
});
